package com.edu.exam.enums.grading;

/**
 * 审计权限类型枚举
 */
public enum AuditPermissionType {
    READ("READ", "读取权限"),
    WRITE("WRITE", "写入权限"),
    DELETE("DELETE", "删除权限"),
    APPROVE("APPROVE", "审批权限"),
    REJECT("REJECT", "拒绝权限"),
    EXPORT("EXPORT", "导出权限"),
    IMPORT("IMPORT", "导入权限"),
    MODIFY("MODIFY", "修改权限"),
    VIEW("VIEW", "查看权限"),
    EXECUTE("EXECUTE", "执行权限");

    private final String code;
    private final String description;

    AuditPermissionType(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static AuditPermissionType fromCode(String code) {
        for (AuditPermissionType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return READ; // 默认返回读取权限
    }
}